package breeze.lepei.der.logo_view.model;
import android.content.SharedPreferences;
import android.content.Context;

public class BackDataModel {
	private static BackDataModel data;
	private SharedPreferences sp;
	public static BackDataModel getInstance(Context context){
		if(data==null){
			data=new BackDataModel(context);
		}
		return data;
	}
	
	public BackDataModel(Context context){
		sp=context.getSharedPreferences("app_back",Context.MODE_PRIVATE);
	}

	public void setVersionCode(int versionCode) {
		sp.edit().putInt("versionCode",versionCode).commit();
	}

	public int getVersionCode() {
		return sp.getInt("versionCode",0);
	}

	public void setDownloadLink(String downloadLink) {
		sp.edit().putString("downdloadLink",downloadLink).commit();
	}

	public String getDownloadLink() {
		return sp.getString("downdloadLink","");
	}

	public void setAnnouncement(String announcement) {
		sp.edit().putString("announcement",announcement).commit();
	}

	public String getAnnouncement() {
		return sp.getString("announcement","");
	}

	public void setLogoLink(String logoLink) {
		sp.edit().putString("logoLink",logoLink).commit();
	}

	public String getLogoLink() {
		return sp.getString("logoLink","");
	}

	public void setIsRunning(String isRunning) {
		sp.edit().putString("isRunning",isRunning).commit();
	}

	public String isRunning() {
		return sp.getString("isRunning","");
	}
	
	public void putUpdateInfo(String info) {
		sp.edit().putString("updateInfo",info).commit();
	}
	
	public String getUpdateInfo() {
		return sp.getString("updateInfo","").replace("*","\n");
	}
}
